<!DOCTYPE HTML>
<html lang="zh-hans" >
    <!-- Start book Linux -->
<!-- Start book Linux -->
    <head>
        <!-- head:start -->
<!-- head:start -->
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Nginx的安装和配置 | Linux</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        <meta name="author" content="chris Jiang">
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="gitbook/style.css">
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-prism/prism.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="./chapter14.html" />
    
    
    <link rel="prev" href="./chapter12.html" />
    

        <!-- head:end -->
<!-- head:end -->
    </head>
    <body>
        <!-- body:start -->
<!-- body:start -->
        
    <div class="book"
        data-level="13"
        data-chapter-title="Nginx的安装和配置"
        data-filepath="chapter13.md"
        data-basepath="."
        data-revision="Mon Sep 30 2019 00:13:13 GMT+0800 (CST)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="./index.html">
                
                        <i class="fa fa-check"></i>
                        
                        学习目标
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="chapter01.html">
            
                
                    <a href="./chapter01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Linux入门
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="01/section01.html">
            
                
                    <a href="./01/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        操作系统介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="01/section02.html">
            
                
                    <a href="./01/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        Linux系统介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="01/section03.html">
            
                
                    <a href="./01/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        使用虚拟机安装Ubuntu
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="01/section04.html">
            
                
                    <a href="./01/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        使用U盘安装双系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="01/section05.html">
            
                
                    <a href="./01/section05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        配置Linux系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="01/section06.html">
            
                
                    <a href="./01/section06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        Linux启动流程
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="01/section07.html">
            
                
                    <a href="./01/section07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        远程连接Linux
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="chapter02.html">
            
                
                    <a href="./chapter02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        软件安装相关指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3" data-path="chapter03.html">
            
                
                    <a href="./chapter03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        文件系统
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="chapter04.html">
            
                
                    <a href="./chapter04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        vim编辑器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="chapter05.html">
            
                
                    <a href="./chapter05.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        目录操作的常见指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="chapter06.html">
            
                
                    <a href="./chapter06.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.</b>
                        
                        python、pip和ipython的安装
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="7" data-path="chapter07.html">
            
                
                    <a href="./chapter07.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>7.</b>
                        
                        虚拟环境管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="8" data-path="chapter08.html">
            
                
                    <a href="./chapter08.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>8.</b>
                        
                        用户管理相关指令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="9" data-path="chapter09.html">
            
                
                    <a href="./chapter09.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>9.</b>
                        
                        权限管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="10" data-path="chapter10.html">
            
                
                    <a href="./chapter10.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>10.</b>
                        
                        压缩解压命令
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="11" data-path="chapter11.html">
            
                
                    <a href="./chapter11.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>11.</b>
                        
                        服务监听
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="12" data-path="chapter12.html">
            
                
                    <a href="./chapter12.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>12.</b>
                        
                        管道和重定向
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="13" data-path="chapter13.html">
            
                
                    <a href="./chapter13.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>13.</b>
                        
                        Nginx的安装和配置
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14" data-path="chapter14.html">
            
                
                    <a href="./chapter14.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.</b>
                        
                        Git的使用
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="14.1" data-path="14/section01.html">
            
                
                    <a href="./14/section01.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.1.</b>
                        
                        git本地和远端管理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.2" data-path="14/section02.html">
            
                
                    <a href="./14/section02.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.2.</b>
                        
                        冲突的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.3" data-path="14/section03.html">
            
                
                    <a href="./14/section03.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.3.</b>
                        
                        分支操作
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="14.4" data-path="14/section04.html">
            
                
                    <a href="./14/section04.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>14.4.</b>
                        
                        远端服务器的SSH连接
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="15" data-path="chapter15.html">
            
                
                    <a href="./chapter15.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>15.</b>
                        
                        shell编程
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    本书使用 GitBook 发布
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="./" >Linux</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="nginx&#x7684;&#x5B89;&#x88C5;&#x548C;&#x914D;&#x7F6E;">Nginx&#x7684;&#x5B89;&#x88C5;&#x548C;&#x914D;&#x7F6E;</h1>
<p>Nginx&#x662F;&#x4E00;&#x6B3E;&#x81EA;&#x7531;&#x7684;&#x3001;&#x5F00;&#x6E90;&#x7684;&#x3001;&#x9AD8;&#x6027;&#x80FD;&#x7684;HTTP&#x670D;&#x52A1;&#x5668;&#x548C;&#x53CD;&#x5411;&#x4EE3;&#x7406;&#x670D;&#x52A1;&#x5668;&#xFF1B;&#x540C;&#x65F6;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;IMAP&#x3001;POP3&#x3001;SMTP&#x4EE3;&#x7406;&#x670D;&#x52A1;&#x5668;&#xFF1B;Nginx&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;HTTP&#x670D;&#x52A1;&#x5668;&#x8FDB;&#x884C;&#x7F51;&#x7AD9;&#x7684;&#x53D1;&#x5E03;&#x5904;&#x7406;&#xFF0C;&#x53E6;&#x5916;Nginx&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x53CD;&#x5411;&#x4EE3;&#x7406;&#x8FDB;&#x884C;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x7684;&#x5B9E;&#x73B0;&#x3002;&#x5728;&#x540E;&#x7EED;&#x6211;&#x4EEC;&#x5B66;&#x4E60;&#x5B8C;Web&#x6846;&#x67B6;&#x4EE5;&#x540E;&#xFF0C;&#x4F1A;&#x6559;&#x5927;&#x5BB6;&#x600E;&#x6837;&#x5C06;&#x4E00;&#x4E2A;web&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x90E8;&#x7F72;&#x5230;Nginx&#x670D;&#x52A1;&#x5668;&#x4E0A;&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x53EA;&#x5BF9;Nginx&#x505A;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4E86;&#x89E3;&#x3002;</p>
<h2 id="&#x4F7F;&#x7528;&#x6E90;&#x7801;&#x5B89;&#x88C5;&#x8F6F;&#x4EF6;">&#x4F7F;&#x7528;&#x6E90;&#x7801;&#x5B89;&#x88C5;&#x8F6F;&#x4EF6;</h2>
<p>&#x6211;&#x4EEC;&#x77E5;&#x9053;&#xFF0C;&#x5728;Linux&#x5E73;&#x53F0;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4E0B;&#x8F7D;&#x4E00;&#x4E2A;deb&#x6587;&#x4EF6;&#xFF0C;&#x4F7F;&#x7528;dpkg&#x6307;&#x4EE4;&#x5B89;&#x88C5;&#x4E00;&#x4E2A;&#x8F6F;&#x4EF6;&#xFF0C;&#x540C;&#x65F6;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;apt-get install &#x5728;&#x7EBF;&#x5B89;&#x88C5;&#x4E00;&#x4E2A;&#x6307;&#x5B9A;&#x7684;&#x8F6F;&#x4EF6;&#x3002;&#x5176;&#x5B9E;&#xFF0C;&#x9664;&#x4E86;&#x8FD9;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#x4EE5;&#x5916;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x7B2C;&#x4E09;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x5373;<span style="color:red">&#x6E90;&#x4EE3;&#x7801;&#x7684;&#x5F62;&#x5F0F;&#x5B89;&#x88C5;&#x8F6F;&#x4EF6;</span></p>
<ul>
<li>&#x4F7F;&#x7528;&#x6E90;&#x4EE3;&#x7801;&#x5B89;&#x88C5;&#x8F6F;&#x4EF6;&#x7684;&#x57FA;&#x672C;&#x6B65;&#x9AA4;:<ul>
<li>&#x914D;&#x7F6E;:configure</li>
<li>&#x7F16;&#x8BD1;&#xFF1A;make</li>
<li>&#x5B89;&#x88C5;: make install</li>
</ul>
</li>
<li>&#x6267;&#x884C;&#x547D;&#x4EE4;<ul>
<li>cmd1; cmd2  # &#x6267;&#x884C;&#x5B8C;cmd1&#x540E;&#xFF0C;&#x6267;&#x884C;cmd2,&#x65E0;&#x8BBA;cmd1&#x6307;&#x4EE4;&#x662F;&#x5426;&#x6267;&#x884C;&#x6210;&#x529F;</li>
<li>cmd1 || cmd2  # &#x5148;&#x6267;&#x884C;cmd1,cmd1&#x6267;&#x884C;&#x5931;&#x8D25;&#x4EE5;&#x540E;&#x624D;&#x4F1A;&#x6267;&#x884C;cmd2</li>
<li>cmd1 &amp;&amp; cmd2 # &#x5148;&#x6267;&#x884C;cdm1,cmd1&#x6267;&#x884C;&#x6210;&#x529F;&#x4EE5;&#x540E;&#xFF0C;&#x624D;&#x4F1A;&#x6267;&#x884C;cmd2</li>
</ul>
</li>
</ul>
<h2 id="&#x4F7F;&#x7528;&#x6E90;&#x7801;&#x5B89;&#x88C5;nginx">&#x4F7F;&#x7528;&#x6E90;&#x7801;&#x5B89;&#x88C5;Nginx</h2>
<ol>
<li><p>&#x4E0B;&#x8F7D;Nginx&#x6E90;&#x7801;&#xFF0C;&#x4E0B;&#x8F7D;&#x5730;&#x5740;: <a href="http://nginx.org/download/nginx-1.16.0.tar.gz" target="_blank">http://nginx.org/download/nginx-1.16.0.tar.gz</a></p>
</li>
<li><p>&#x89E3;&#x538B;&#x8F6F;&#x4EF6;&#x538B;&#x7F29;&#x5305;&#xFF1A; <code>tar -zxvf nginx-1.16.0.tar.gz</code></p>
</li>
<li><p>&#x7F16;&#x8BD1;&#x524D;&#x6267;&#x884C;&#x914D;&#x7F6E;&#x6587;&#x4EF6;: <code>./configure --prefix=/usr/local/nginx</code></p>
<ul>
<li>&#x2014;prefix:&#x7528;&#x6765;&#x914D;&#x7F6E;Nginx&#x670D;&#x52A1;&#x5668;&#x7684;&#x5B89;&#x88C5;&#x76EE;&#x5F55;</li>
<li>&#x914D;&#x7F6E;&#x51FA;&#x9519;&#x591A;&#x6570;&#x662F;&#x56E0;&#x4E3A;&#x7F3A;&#x5C11;&#x76F8;&#x5173;&#x7684;&#x4F9D;&#x8D56;&#x5E93;&#x6216;&#x8005;&#x7F16;&#x8BD1;&#x5668;</li>
<li><p>&#x9700;&#x8981;&#x5B89;&#x88C5;&#x76F8;&#x5173;&#x7684;&#x4F9D;&#x8D56;&#xFF0C;&#x5982;<code>sudo apt-get install gcc libpcre3-dev zlib1g-dev</code></p>
</li>
<li><p>&#x8FD0;&#x884C; <code>make &amp;&amp; make install</code> &#x547D;&#x4EE4;&#x6765;&#x7F16;&#x8BD1;&#x5E76;&#x5B89;&#x88C5;&#x8F6F;&#x4EF6;</p>
</li>
</ul>
</li>
<li><p>Nginx&#x4ECB;&#x7ECD;</p>
<ul>
<li>&#x8FDB;&#x5165;&#x5230;<code>/usr/local/nginx/sbin</code> &#x5B89;&#x88C5;&#x76EE;&#x5F55;&#xFF0C;&#x4F7F;&#x7528; <code>./nginx</code> &#x547D;&#x4EE4;&#x542F;&#x52A8;nginx</li>
<li>html&#xFF1A;&#x9ED8;&#x8BA4;&#x7AD9;&#x70B9;&#x76EE;&#x5F55;</li>
<li>&#x6D4B;&#x8BD5;&#xFF1A;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#x8F93;&#x5165;localhost&#xFF0C;&#x770B;&#x5230;welcome to nginx&#x5373;&#x8868;&#x793A;&#x6210;&#x529F;</li>
</ul>
</li>
</ol>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="./chapter12.html" class="navigation navigation-prev " aria-label="Previous page: 管道和重定向"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="./chapter14.html" class="navigation navigation-next " aria-label="Next page: Git的使用"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="gitbook/app.js"></script>

    
    <script src="gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-copy-code-button/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-toggle-chapters/toggle.js"></script>
    

    
    <script src="gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"prism":{},"splitter":{},"copy-code-button":{},"toggle-chapters":{},"highlight":{},"fontsettings":{"theme":"white","family":"sans","size":2}};
    gitbook.start(config);
});
</script>

        <!-- body:end -->
<!-- body:end -->
    </body>
    <!-- End of book Linux -->
<!-- End of book Linux -->
</html>
